#ifndef JNIDEMO_REGISTER_H
#define JNIDEMO_REGISTER_H

#include <jni.h>
#include "DataBean.h"

// 对应 .DataBean 类
typedef struct data_bean_block_t {
    jclass clazz;
    jfieldID  rtFlag;
    jfieldID  version;
    jfieldID  pkLen;
    jfieldID  pkId;
    jfieldID  pkCmd;
    jfieldID  pkAck;
    jfieldID  paraCnt;
    jfieldID  ol; // 16bit unsigned int
    jfieldID  oid;  // 16bit unsigned int
    jfieldID  val;
    jfieldID startPoint; // 32bit unsigned int
    jfieldID stopPoint;  // 32bit unsigned int
    jfieldID reportArrayVal;
    jfieldID formPkArray;
    jmethodID constructor;
} data_bean_block;


// // 对应 .DataBean 类
// typedef struct data_bean_block_t {
//     jclass clazz;
//     jfieldID  version;
//     jfieldID  pkid;
//     jfieldID  oid;
//     jfieldID  data;
//     jmethodID constructor;
// } data_bean_block;

// 注册
void register_classes(JNIEnv *env);

// C结构体转Java类
jobject data_bean_c_to_java(JNIEnv *env, jni_data_bean *data_bean);

// Java类转C结构体
void data_bean_java_to_c(JNIEnv *env, jobject data_bean_in,jni_data_bean *cData_beanOut);
// Java类转C结构体
void updateFormPk_c_to_java(JNIEnv *env, jobject jData_bean, jni_data_bean *cData_bean);

#endif //JNIDEMO_REGISTER_H
